<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: misc_emailcheck.php 6752 2010-03-25 08:47:54Z cnteacher $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

$uid = 0;
$email = '';
$_GET['hash'] = empty($_GET['hash']) ? '' : trim($_GET['hash']);
if($_GET['hash']) {
	list($uid, $email) = explode("\t", authcode($_GET['hash'], 'DECODE'));
	$uid = intval($uid);
}

if($uid && isemail($email)) {
	if($_G['setting']['uniqueemail']) {
		if(getcount('common_member', array('email'=>$email, 'emailstatus'=>1))) {
			showmessage('uniqueemail_recheck');
		}
	}
	updatecreditbyaction('realemail', $uid);
	DB::update('common_member', array('email'=>addslashes($email), 'emailstatus'=>'1'), array('uid'=>$uid));

	showmessage('email_check_sucess', '', array($email));
} else {
	showmessage('email_check_error');
}

?>